<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/template/main_template.xhtml" 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:sec="http://www.springframework.org/security/tags">
	
<ui:define name="title">
Project Setup
</ui:define>

<ui:define name="content">	

<p:panel id="panel" header="Project Setup - Property Units for #{projectSetup.project.projectName}" style="width:95%">  

<p:focus context="panel"/> 
      
	<h:form>  
    	<p:dataTable var="c" value="#{projectSetup.inventories}" paginator="true" rows="10"  paginatorPosition="bottom"
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="10,20,40,60,80,100" >   
 
                 
        <p:column headerText="Block" sortBy="#{c.blockNo}">  
            <h:outputText value="#{c.blockNo}">
            	
            </h:outputText>
        </p:column>  
  
        <p:column headerText="Level" sortBy="#{c.level}">  
           <h:outputText value="#{c.level}"/>
        </p:column>  
  
        <p:column headerText="Unit No." sortBy="#{c.unitNo}">  
            <h:outputText value="#{c.unitNo}">
            </h:outputText>
        </p:column>  
  
        <p:column headerText="Type" sortBy="#{c.layoutType}">  
           <h:outputText value="#{c.layoutType}"/>
        </p:column>  
        
        <p:column headerText="B/U Area" sortBy="#{c.builtUpArea}">  
           	<h:outputText value="#{c.builtUpArea}">
          	 	<f:convertNumber pattern="#,##0"/>
           	</h:outputText>
        </p:column>  
        
        <p:column headerText="Price" sortBy="#{c.purchasePrice}">  
           	<h:outputText value="#{c.purchasePrice}">
           		<f:convertNumber type="currency" currencySymbol="" />
           	</h:outputText>
        </p:column>
        
        <p:column headerText="Action">  
           	<p:commandButton action="#{projectSetup.editInventory}" ajax="false" icon="ui-icon-pencil" title="Edit Property Unit">
           		<f:setPropertyActionListener value="#{c}" target="#{projectSetup.inventory}" />  
           	</p:commandButton>
 			&nbsp;
           	<p:commandButton id="showDialogButton" ajax="false" icon="ui-icon-trash" title="Delete Property Unit" onclick="confirmation.show()" type="button"/>  
      
    		<p:confirmDialog id="confirmDialog" message="Do you want to delete this property?"  
                header="Confirmation" severity="alert" widgetVar="confirmation">  
                <p:panelGrid styleClass="no-borders" style="width:100%">
                <p:row>
                <p:column style="text-align:center">
					<p:commandButton action="#{projectSetup.deleteInventory}" ajax="false" value="Yes" oncomplete="confirmation.hide()">
	       		 		<f:setPropertyActionListener value="#{c}" target="#{projectSetup.inventory}" /> 
	       			</p:commandButton>
	       		</p:column>
	       		<p:column style="text-align:center">
	       			<p:commandButton value="Cancel" onclick="confirmation.hide()"/>  
                </p:column>
                </p:row>
                </p:panelGrid>
    		</p:confirmDialog>  
        </p:column>

    </p:dataTable>  
    
    <br/>
    <p:commandButton value="Back" action="#{projectSetup.listProject}" ajax="false" immediate="true" icon="ui-icon-arrowreturn-1-w"/>  &nbsp;&nbsp;
    <p:commandButton action="#{projectSetup.addInventory}" value="Add Property Unit" ajax="false"/>
</h:form> 

</p:panel>

</ui:define>

</ui:composition>